/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */
#ifndef __QS_NodeInfoBox_H__
#define __QS_NodeInfoBox_H__

#include "Prerequisites.h"

#include <QtGui/QGraphicsItem>
#include "DiagramNode.h"

namespace QSThink
{
	class DiagramView;

	class NodeInfoBox
		: public QGraphicsItem
	{
	public:
		NodeInfoBox();

		enum { Type = UserType + 3 };
		int type() const { return Type; }

		void setNode(DiagramNode* node);
	protected:
		//QRectF QGraphicsItem::boundingRect () const   [pure virtual]
		QRectF boundingRect() const;
		
		//QPainterPath QGraphicsItem::shape () const   [virtual]
		QPainterPath shape() const;

		//void QGraphicsItem::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 )   [pure virtual]
		void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

	protected:
		//QVariant QGraphicsItem::itemChange ( GraphicsItemChange change, const QVariant & value )   [virtual protected]
		QVariant itemChange(GraphicsItemChange change, const QVariant &value);

		void mousePressEvent(QGraphicsSceneMouseEvent *event);
		void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
		void paintSingle(QPainter * painter,  TransactionSingle* t );
		void paint2Minutes( QPainter * painter, Transaction2Minutes* t );
		void paint1Day( QPainter * painter, Transaction1Day* t );

	protected:
		DiagramNode* _node;//node that info it.
	};
}
#endif
